<?php
class Controllers_Test extends RestController {
    public function get() {
        $this->response = array('TestResponse' => null);
        $this->responseStatus = 501;
    }

    public function post() {
        require_once("Config/connexion.php");
        
        $params = $this->request['params'];
        $responseStatus = 200;
   
        //$country = R::load('tg_countries', 4);
        
        //$countries = R::find('tg_countries',' name = ?', array( "Boukistan" ));
        
        //var_dump($countries);
     
        $userid = 1;
        $city_name = "Merigna";
        $country_name = "France";
        
        $selectSoumis = 'SELECT tg_score.id from tg_score, tg_cities, tg_countries where users_id = '.$userid.' and tg_cities.name = "'.$city_name.'" and tg_countries.name = "'.$country_name.'" and tg_score.cities_id = tg_cities.id and tg_cities.countries_id = tg_countries.id';
        
       
        $result = R::getRow($selectSoumis);
        
        var_dump($result);
        
        //foreach ($countries as $country) {
        //    echo($country->id . " " . $country->name);
        //}
        
        //$country = R::dispense('tg_countries');
        //$country->name = "Espagne";
        
        //R::store($country);
        
        $this->response = array('Response' => "reponse");
        $this->responseStatus = $responseStatus;
    }
    public function put() {
            $this->response = array('TestResponse' => null);
            $this->responseStatus = 501;
    }

    public function delete() {
            $this->response = array('TestResponse' => null);
            $this->responseStatus = 501;
    }
        
}